package cn.wolfcode.crm.query;

import cn.wolfcode.crm.util.DateUtil;
import com.alibaba.druid.util.StringUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/*
* 客户开发计划高级查询信息
*
* */
@Getter
@Setter
public class ClientDevelopmentPlanObjectQuery extends ObjectQuery {
    //员工名字
    private String checkName;

    //客户姓名或者员工姓名
    private String keyword;
    //开发进度
    private int queryForschedule=-1;
    //排序规则
    private String order;
    //排序依据列
    private String sort;

    public String getSort(){
        if(StringUtils.isEmpty(sort)){
            return null;
        }
        return sort;
    }
    public String getOrder(){
        if(StringUtils.isEmpty(order)){
            return "";
        }
        return order;
    }
    public String getKeyword() {
        if (keyword != null && "".equals(keyword.trim())) {
            return null;
        }
        return keyword;
    }
    //根据时间查询
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    //得到日期的最后一秒
    public Date getBeginDate(){
        if(beginDate!=null){
            return DateUtil.getEndDate(beginDate);
        }
        return beginDate;
    }
    public Date getEndDate(){
        if(endDate!=null){
            return DateUtil.getEndDate(endDate);
        }
        return endDate;
    }
}
